package com.daily.pump.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

public class InteceptFrameLayout extends ConstraintLayout {

    private boolean intecept = true;

    public InteceptFrameLayout(@NonNull Context context) {
        super(context);
    }

    public InteceptFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public InteceptFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (intecept) {
            return true;
        }
        return super.onTouchEvent(event);
    }

    public void setIntecept(boolean intecept) {
        this.intecept = intecept;
    }

    public boolean isIntecept() {
        return intecept;
    }
}
